﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Library.Business;
namespace MyLog
{
    public class Log_DB
    {
        public void setLog(string _NameClass,string _Desc)
        {
            try {
                Cls_SYS_LogErr _clLog = new Cls_SYS_LogErr();

                if (_clLog.countRows(false) > 50)
                {
                    Detete_ALL();
                }
                //
                _clLog.Time_Sort = DateTime.Now;
                _clLog.NameClass = _NameClass;
                _clLog.Description = _Desc;
                _clLog.doInsert();
            }
            catch(Exception ex) {
                throw ex;
            }
        }
        public void Detete_ALL()
        {
            try {
                Cls_SYS_LogErr _clLog = new Cls_SYS_LogErr();
                _clLog.doSQL("TRUNCATE TABLE tbSYS_LogErr");
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}
